Release 10.1A: OpenEdge Development:
Progress 4GL Reference


TIME function

Returns an integer representing the time in seconds. If the TIME function has no arguments, it returns the number of seconds since midnight. Use this function together with the STRING function to produce the time in hours, minutes, and seconds.

Syntax

TIME 

Examples

In r-time.p, the timeleft variable is set to the result of the TIME function subtracted from the number of seconds in a day. The procedure translates this value into seconds, minutes, and hours.

r-time.p
DEFINE VARIABLE hour AS INTEGER.
DEFINE VARIABLE minute AS INTEGER.
DEFINE VARIABLE sec AS INTEGER.
DEFINE VARIABLE timeleft AS INTEGER.

timeleft = (24 * 60 * 60) - TIME.  

/* seconds till next midnight */
sec = timeleft MOD 60.
timeleft = (timeleft - sec) / 60.  

/* minutes till next midnight */
minute = timeleft MOD 60.

/* hours till next midnight */
hour = (timeleft - minute) / 60.   

DISPLAY "Time to midnight:" hour  minute  sec . 

This DISPLAY statement displays the current time.

r-time2.p
DISPLAY STRING(TIME,"HH:MM:SS"). 

See also

DATETIME function, DATETIME-TZ function, ETIME function, MTIME function, NOW function, TIMEZONE function


Copyright © 2005 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095